3.39 \(\int \frac{\sin ^2(e+f x)}{(a+b \sin (e+f x))^2 (c+d \sin (e+f x))} \, dx\)

Optimal. Leaf size=181 \[ -\frac{2 a \left (a^2 c+a b d-2 b^2 c\right ) \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (e+f x)\right )+b}{\sqrt{a^2-b^2}}\right )}{f \left (a^2-b^2\right )^{3/2} (b c-a d)^2}+\frac{a^2 \cos (e+f x)}{f \left (a^2-b^2\right ) (b c-a d) (a+b \sin (e+f x))}+\frac{2 c^2 \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{f \sqrt{c^2-d^2} (b c-a d)^2} \]

[Out]

(-2*a*(a^2*c - 2*b^2*c + a*b*d)*ArcTan[(b + a*Tan[(e + f*x)/2])/Sqrt[a^2 - b^2]])/((a^2 - b^2)^(3/2)*(b*c - a*
d)^2*f) + (2*c^2*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/((b*c - a*d)^2*Sqrt[c^2 - d^2]*f) + (a^2*Co
s[e + f*x])/((a^2 - b^2)*(b*c - a*d)*f*(a + b*Sin[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.508703, antiderivative size = 181, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 5, integrand size = 33, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.152, Rules used = {3056, 3001, 2660, 618, 204} \[ -\frac{2 a \left (a^2 c+a b d-2 b^2 c\right ) \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (e+f x)\right )+b}{\sqrt{a^2-b^2}}\right )}{f \left (a^2-b^2\right )^{3/2} (b c-a d)^2}+\frac{a^2 \cos (e+f x)}{f \left (a^2-b^2\right ) (b c-a d) (a+b \sin (e+f x))}+\frac{2 c^2 \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{f \sqrt{c^2-d^2} (b c-a d)^2} \]

Antiderivative was successfully verified.

[In]

Int[Sin[e + f*x]^2/((a + b*Sin[e + f*x])^2*(c + d*Sin[e + f*x])),x]

[Out]

(-2*a*(a^2*c - 2*b^2*c + a*b*d)*ArcTan[(b + a*Tan[(e + f*x)/2])/Sqrt[a^2 - b^2]])/((a^2 - b^2)^(3/2)*(b*c - a*
d)^2*f) + (2*c^2*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/((b*c - a*d)^2*Sqrt[c^2 - d^2]*f) + (a^2*Co
s[e + f*x])/((a^2 - b^2)*(b*c - a*d)*f*(a + b*Sin[e + f*x]))

Rule 3056

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (C_.)*s
in[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> -Simp[((A*b^2 + a^2*C)*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1)*(c +
d*Sin[e + f*x])^(n + 1))/(f*(m + 1)*(b*c - a*d)*(a^2 - b^2)), x] + Dist[1/((m + 1)*(b*c - a*d)*(a^2 - b^2)), I
nt[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[a*(m + 1)*(b*c - a*d)*(A + C) + d*(A*b^2 + a^2*C)*
(m + n + 2) - (c*(A*b^2 + a^2*C) + b*(m + 1)*(b*c - a*d)*(A + C))*Sin[e + f*x] - d*(A*b^2 + a^2*C)*(m + n + 3)
*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0]
 && NeQ[c^2 - d^2, 0] && LtQ[m, -1] && ((EqQ[a, 0] && IntegerQ[m] &&  !IntegerQ[n]) ||  !(IntegerQ[2*n] && LtQ
[n, -1] && ((IntegerQ[n] &&  !IntegerQ[m]) || EqQ[a, 0])))

Rule 3001

Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.)
+ (f_.)*(x_)])), x_Symbol] :> Dist[(A*b - a*B)/(b*c - a*d), Int[1/(a + b*Sin[e + f*x]), x], x] + Dist[(B*c - A
*d)/(b*c - a*d), Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]

Rule 2660

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[(2*e)/d, Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{\sin ^2(e+f x)}{(a+b \sin (e+f x))^2 (c+d \sin (e+f x))} \, dx &=\frac{a^2 \cos (e+f x)}{\left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))}-\frac{\int \frac{-a b c-\left (a^2 c-b^2 c+a b d\right ) \sin (e+f x)}{(a+b \sin (e+f x)) (c+d \sin (e+f x))} \, dx}{\left (a^2-b^2\right ) (b c-a d)}\\ &=\frac{a^2 \cos (e+f x)}{\left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))}+\frac{c^2 \int \frac{1}{c+d \sin (e+f x)} \, dx}{(b c-a d)^2}-\frac{\left (a \left (a^2 c-2 b^2 c+a b d\right )\right ) \int \frac{1}{a+b \sin (e+f x)} \, dx}{\left (a^2-b^2\right ) (b c-a d)^2}\\ &=\frac{a^2 \cos (e+f x)}{\left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))}+\frac{\left (2 c^2\right ) \operatorname{Subst}\left (\int \frac{1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{(b c-a d)^2 f}-\frac{\left (2 a \left (a^2 c-2 b^2 c+a b d\right )\right ) \operatorname{Subst}\left (\int \frac{1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{\left (a^2-b^2\right ) (b c-a d)^2 f}\\ &=\frac{a^2 \cos (e+f x)}{\left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))}-\frac{\left (4 c^2\right ) \operatorname{Subst}\left (\int \frac{1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac{1}{2} (e+f x)\right )\right )}{(b c-a d)^2 f}+\frac{\left (4 a \left (a^2 c-2 b^2 c+a b d\right )\right ) \operatorname{Subst}\left (\int \frac{1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac{1}{2} (e+f x)\right )\right )}{\left (a^2-b^2\right ) (b c-a d)^2 f}\\ &=-\frac{2 a \left (a^2 c-2 b^2 c+a b d\right ) \tan ^{-1}\left (\frac{b+a \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2} (b c-a d)^2 f}+\frac{2 c^2 \tan ^{-1}\left (\frac{d+c \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c^2-d^2}}\right )}{(b c-a d)^2 \sqrt{c^2-d^2} f}+\frac{a^2 \cos (e+f x)}{\left (a^2-b^2\right ) (b c-a d) f (a+b \sin (e+f x))}\\ \end{align*}

Mathematica [A]  time = 1.09792, size = 178, normalized size = 0.98 \[ \frac{-\frac{2 a \left (a^2 c+a b d-2 b^2 c\right ) \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (e+f x)\right )+b}{\sqrt{a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2} (b c-a d)^2}-\frac{a^2 \cos (e+f x)}{(a-b) (a+b) (a d-b c) (a+b \sin (e+f x))}+\frac{2 c^2 \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2} (b c-a d)^2}}{f} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[e + f*x]^2/((a + b*Sin[e + f*x])^2*(c + d*Sin[e + f*x])),x]

[Out]

((-2*a*(a^2*c - 2*b^2*c + a*b*d)*ArcTan[(b + a*Tan[(e + f*x)/2])/Sqrt[a^2 - b^2]])/((a^2 - b^2)^(3/2)*(b*c - a
*d)^2) + (2*c^2*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/((b*c - a*d)^2*Sqrt[c^2 - d^2]) - (a^2*Cos[e
 + f*x])/((a - b)*(a + b)*(-(b*c) + a*d)*(a + b*Sin[e + f*x])))/f

________________________________________________________________________________________

Maple [B]  time = 0.159, size = 606, normalized size = 3.4 \begin{align*} 8\,{\frac{{c}^{2}}{f \left ( 4\,{a}^{2}{d}^{2}-8\,abcd+4\,{c}^{2}{b}^{2} \right ) \sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( 1/2\,fx+e/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }-2\,{\frac{{a}^{2}b\tan \left ( 1/2\,fx+e/2 \right ) d}{f \left ({a}^{2}{d}^{2}-2\,abcd+{c}^{2}{b}^{2} \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}a+2\,\tan \left ( 1/2\,fx+e/2 \right ) b+a \right ) \left ({a}^{2}-{b}^{2} \right ) }}+2\,{\frac{a{b}^{2}\tan \left ( 1/2\,fx+e/2 \right ) c}{f \left ({a}^{2}{d}^{2}-2\,abcd+{c}^{2}{b}^{2} \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}a+2\,\tan \left ( 1/2\,fx+e/2 \right ) b+a \right ) \left ({a}^{2}-{b}^{2} \right ) }}-2\,{\frac{{a}^{3}d}{f \left ({a}^{2}{d}^{2}-2\,abcd+{c}^{2}{b}^{2} \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}a+2\,\tan \left ( 1/2\,fx+e/2 \right ) b+a \right ) \left ({a}^{2}-{b}^{2} \right ) }}+2\,{\frac{{a}^{2}bc}{f \left ({a}^{2}{d}^{2}-2\,abcd+{c}^{2}{b}^{2} \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}a+2\,\tan \left ( 1/2\,fx+e/2 \right ) b+a \right ) \left ({a}^{2}-{b}^{2} \right ) }}-2\,{\frac{{a}^{3}c}{f \left ({a}^{2}{d}^{2}-2\,abcd+{c}^{2}{b}^{2} \right ) \left ({a}^{2}-{b}^{2} \right ) ^{3/2}}\arctan \left ( 1/2\,{\frac{2\,a\tan \left ( 1/2\,fx+e/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}}}} \right ) }-2\,{\frac{{a}^{2}bd}{f \left ({a}^{2}{d}^{2}-2\,abcd+{c}^{2}{b}^{2} \right ) \left ({a}^{2}-{b}^{2} \right ) ^{3/2}}\arctan \left ( 1/2\,{\frac{2\,a\tan \left ( 1/2\,fx+e/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}}}} \right ) }+4\,{\frac{a{b}^{2}c}{f \left ({a}^{2}{d}^{2}-2\,abcd+{c}^{2}{b}^{2} \right ) \left ({a}^{2}-{b}^{2} \right ) ^{3/2}}\arctan \left ( 1/2\,{\frac{2\,a\tan \left ( 1/2\,fx+e/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}}}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(f*x+e)^2/(a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x)

[Out]

8/f*c^2/(4*a^2*d^2-8*a*b*c*d+4*b^2*c^2)/(c^2-d^2)^(1/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2
))-2/f*a^2/(a^2*d^2-2*a*b*c*d+b^2*c^2)/(tan(1/2*f*x+1/2*e)^2*a+2*tan(1/2*f*x+1/2*e)*b+a)*b/(a^2-b^2)*tan(1/2*f
*x+1/2*e)*d+2/f*a/(a^2*d^2-2*a*b*c*d+b^2*c^2)/(tan(1/2*f*x+1/2*e)^2*a+2*tan(1/2*f*x+1/2*e)*b+a)*b^2/(a^2-b^2)*
tan(1/2*f*x+1/2*e)*c-2/f*a^3/(a^2*d^2-2*a*b*c*d+b^2*c^2)/(tan(1/2*f*x+1/2*e)^2*a+2*tan(1/2*f*x+1/2*e)*b+a)/(a^
2-b^2)*d+2/f*a^2/(a^2*d^2-2*a*b*c*d+b^2*c^2)/(tan(1/2*f*x+1/2*e)^2*a+2*tan(1/2*f*x+1/2*e)*b+a)/(a^2-b^2)*c*b-2
/f*a^3/(a^2*d^2-2*a*b*c*d+b^2*c^2)/(a^2-b^2)^(3/2)*arctan(1/2*(2*a*tan(1/2*f*x+1/2*e)+2*b)/(a^2-b^2)^(1/2))*c-
2/f*a^2/(a^2*d^2-2*a*b*c*d+b^2*c^2)/(a^2-b^2)^(3/2)*arctan(1/2*(2*a*tan(1/2*f*x+1/2*e)+2*b)/(a^2-b^2)^(1/2))*b
*d+4/f*a/(a^2*d^2-2*a*b*c*d+b^2*c^2)/(a^2-b^2)^(3/2)*arctan(1/2*(2*a*tan(1/2*f*x+1/2*e)+2*b)/(a^2-b^2)^(1/2))*
b^2*c

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2/(a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2/(a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)**2/(a+b*sin(f*x+e))**2/(c+d*sin(f*x+e)),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.3561, size = 404, normalized size = 2.23 \begin{align*} \frac{2 \,{\left (\frac{{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (c\right ) + \arctan \left (\frac{c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + d}{\sqrt{c^{2} - d^{2}}}\right )\right )} c^{2}}{{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt{c^{2} - d^{2}}} - \frac{{\left (a^{3} c - 2 \, a b^{2} c + a^{2} b d\right )}{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (a\right ) + \arctan \left (\frac{a \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + b}{\sqrt{a^{2} - b^{2}}}\right )\right )}}{{\left (a^{2} b^{2} c^{2} - b^{4} c^{2} - 2 \, a^{3} b c d + 2 \, a b^{3} c d + a^{4} d^{2} - a^{2} b^{2} d^{2}\right )} \sqrt{a^{2} - b^{2}}} + \frac{a b \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + a^{2}}{{\left (a^{2} b c - b^{3} c - a^{3} d + a b^{2} d\right )}{\left (a \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} + 2 \, b \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + a\right )}}\right )}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2/(a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="giac")

[Out]

2*((pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d^2)))*c^2/((b^2*
c^2 - 2*a*b*c*d + a^2*d^2)*sqrt(c^2 - d^2)) - (a^3*c - 2*a*b^2*c + a^2*b*d)*(pi*floor(1/2*(f*x + e)/pi + 1/2)*
sgn(a) + arctan((a*tan(1/2*f*x + 1/2*e) + b)/sqrt(a^2 - b^2)))/((a^2*b^2*c^2 - b^4*c^2 - 2*a^3*b*c*d + 2*a*b^3
*c*d + a^4*d^2 - a^2*b^2*d^2)*sqrt(a^2 - b^2)) + (a*b*tan(1/2*f*x + 1/2*e) + a^2)/((a^2*b*c - b^3*c - a^3*d +
a*b^2*d)*(a*tan(1/2*f*x + 1/2*e)^2 + 2*b*tan(1/2*f*x + 1/2*e) + a)))/f